The present invention relates to an analog signal processing apparatus and method, and more specifically, to an analog signal processing apparatus and method for a reference voltage of a microcontroller to be dynamically adjustable so as to avoid errors resulted from noise interference or voltage drift in the input analog signals of the microcontroller.
With the technology advancing, utilization of computer systems becomes more common. With regard to computer system user interface, to satisfy operation convenience, more and more computer system peripherals are developed to improve the performance of the computer systems and to provide user-friendly interface between users and the computer systems. Among currently computer system peripherals, such as computer system mouse, scanner, fax machine, bar-code reader, etc., are all products developed with application of photoelectronic technology, and one important characteristic of all these products is the conversion of input analog signals to digital signals by use of photoelectronic components and the subsequent process of the digital signals by microcontrollers to complete the task.
In a computer system mouse for instance, referring to FIG. 1, there is a known computer system mouse control apparatus including an LED 11, an optical grating 12, two sets of photoelectronic converters 13 and 14, and two sets of analog/digital signal converters 15 and 16. Its operation principle is that when the LED 11 emits light, light and dark interleaving light signals can be generated by the special shielding effect of the light grating 12 during the mouse moves, the light signals are transferred to the photoelectronic converters 13 and 14 each contains an photoelectronic transistor, and two similar analog sinusoidal signals 101 and 102 can be obtained by the photoelectronic conversion of the photoelectronic converters 13 and 14. Then the similar analog sinusoidal signals 101 and 102 are converted to two digital signals 103 and 104 by means of the analog/digital signal converter 15 and 16 and are outputted for processing by a microcontroller. Referring to FIGS. 2A and 2B, it is shown the waveforms of the known computer system mouse input signals with a phase difference of 90 degrees between the analog input signals 201 and 202. In case that the input signal 202 leads the signal 202, the direction of the mouse movement is defined as positive, as shown in FIG. 2A, otherwise as negative as shown in FIG. 2B.
Analog to digital signal converters 15 and 16 illustrated in FIG. 1 contain a reference voltage and a comparator to compare the input analog signals 101 and 102 with the reference voltage in turn. As shown in FIG. 3 for the diagram of a conventional analog to digital conversion in a mouse, in case an analog signal 31 is higher than a reference voltage 32, it is defined to be in the state xe2x80x9c1xe2x80x9d of a digital signal, otherwise in the state xe2x80x9c0xe2x80x9d. With such comparison, a digital signal 33 can be obtained for subsequent processing for a microcontroller.
However, a few irritating problems exist during the design and production process of the computer system peripheral mentioned above. Again, in a computer system mouse for example, during the production process of the computer system mouse, the voltage drift of an input analog signal may result due to parameter errors in components, such as photoelectronic transistor, light emitting diode, optical grating, etc., or production errors such as component deviation, etc. Referring to FIGS. 4A and 4B, the influence of the above factors during design and production results in the phenomenon that the voltage of an input analog sinusoidal signal 41 is too high as shown in FIG. 4A, or the voltage of an input analog sinusoidal signal 42 is too low, as shown in FIG. 4B. However, since the reference voltage (shown in dotted lines) is fixed, abnormal digital output signals 43 and 44 are generated. Those errors do not result from the factors such as component malfunction or design deficiencies, while they may seriously affect the yield of production. To improve the situation, manufacturers have to select more precise components and purchase more precise equipments. In that case, even the production cost increases tremendously, the effects of improvement is very limited.
Therefore, with the insight into the errors in the conventional production process, it is developed an analog signal processing apparatus and method, by whice the reference voltage for a microcontroller applied in the computer system peripheral, such as computer system mouse, are designed to be dynamically adjustable to avoid errors due to signal noise interference or voltage drift in the input analog signals of the microcontroller.
One object of the present invention is to provide an apparatus for analog signal processing, which is used to avoid the errors due to signal noise interference or voltage drift in the input. analog signals of the microcontroller.
Another object of the present invention is to provide an apparatus for analog signal processing, which is used to dynamically adjust the reference voltage for a microcontroller to convert analog signals to digital signals.
Yet another object of the present invention is to provide a method for analog signal processing, which generates dynamically adjustable reference voltage for a microcontroller to convert input analog signals to digital signals.
According to the first aspect of a first preferred embodiment of the present invention, an analog signal processing apparatus for generating a reference voltage for a microcontroller comprises a first input apparatus for input of a first analog signal, a second input apparatus for input of a second analog signal, an interrupt generating apparatus to generate an interrupt signal when the first analog signal and the second analog signal cross over, a voltage level determination apparatus to generate a voltage level determination signal, a first crossover voltage latch apparatus to input the first analog signal and the voltage level determination signal and output a first crossover voltage latch signal, a second crossover voltage latch apparatus to input the second analog signal and the voltage level determination signal and output a second crossover voltage latch signal, a first storage apparatus to store the first crossover latch signal and feedback the first crossover voltage latch signal to the first input apparatus, and a second storage apparatus to store the second crossover voltage latch signal and feedback the second crossover latch voltage signal to the second input apparatus.
According to the design described above, the microcontroller is contained within a computer system peripheral such as a computer system mouse. The first and second analog signals are sinusoidal signals with a phase difference of 90 degrees there between. The interrupt generating apparatus comprises a difference signal generating apparatus to generate a difference signal of the first analog signal as well as the second analog signal, an edge trigger circuit to generate an edge trigger signal when the difference signal changes its state (i.e. when the two analog signals crossover), and an interrupt controller which corresponds the edge trigger signal to generate an interrupt to the microcontroller when the two analog signals cross over.
The aforementioned first crossover voltage latch apparatus, the second crossover voltage latch apparatus and the difference signal generating apparatus are implemented with a comparator, respectively, while the first and second storage apparatus are implemented with an I/O register, respectively. The voltage level determination apparatus comprises a programmable analog to digital controller and a control register used to output a fixed voltage as the voltage determination signal. Under the modulation by the control register, the programmable analog to digital controller can output multiple fixed voltages.
According to the second aspect of the first preferred embodiment of the present invention, a method for generating a reference voltage for a microcontroller comprises the following steps: (a) providing a first analog signal and a second analog signal with a phase difference there between, (b) generating an interrupt signal to the microcontroller when the first and second analog signal cross over, (c) evaluating a positive crossover voltage and a negative crossover voltage of the first and second analog signal, (d) returning to step (c) if the difference between the positive and negative crossover voltage is less than a predetermined voltage, and calculating an average of the positive and negative crossover voltage as a temporary reference voltage if the difference between the positive and negative crossover voltage is larger than or equal to a predetermined voltage, and (e) repeating steps (c) and (d) until the first and second analog signal are free from voltage drift and noise interference and calculating the average of the temporary reference voltages as a reference voltage of the microcontroller.
The first and second analog signals described above are sinusoidal signal, respectively, and the phase difference is 90 degrees. Preferably, the positive and negative crossover voltages are obtained by means of a binary search.
According to the first aspect of a second preferred embodiment of the present invention, an analog signal processing apparatus for generating a reference voltage for a microcontroller comprises a first input apparatus for input of a first analog signal, a second input apparatus for input of a second analog signal, a voltage level determination apparatus to generate a voltage level determination signal, a first crossover voltage latch apparatus to input the first analog signal and the voltage level determination signal and output a first crossover voltage latch signal, a second crossover voltage latch apparatus to input the second analog signal and the voltage level determination signal and output a second crossover voltage latch signal, a first storage apparatus to store the first crossover voltage signal, and a second storage apparatus to store the second crossover voltage signal.
According to the design described above, the microcontroller is contained within a computer system peripheral such as a computer system mouse. The first and second analog signals are sinusoidal signal with a phase difference of 90 degrees there between.
The aforementioned first crossover voltage latch apparatus, the second crossover voltage latch apparatus are implemented with a comparator, respectively, while the first and second storage apparatus are implemented with an I/O register, respectively. The voltage level determination apparatus comprises a programmable analog to digital controller and a control register, and is used to output a fixed voltage as the voltage level determination signal. Under the modulation by the control register, the programmable analog to digital controller can output multiple fixed voltages.
According to the second aspect of the second preferred embodiment of the present invention, a method for generating a reference voltage for a microcontroller comprises the following steps: (a) providing a first analog signal and a second analog signal with a phase difference there between, (b) setting a sampling interval, (c) sampling the first and second analog signal to obtain voltages of the first and second analog signal at a first sampling point and voltages of the first and second analog signal at a second sampling point, (d) comparing the voltage of the first analog signal with the voltage of the second analog signal at the first sampling point and comparing the voltage of the first analog signal and the voltage of the second analog signal at the second sampling point, (e), calculating the average of the first analog signal voltage and the second analog signal voltage at the first sampling point or the average of the first analog signal voltage and the second analog signal voltage at the second sampling point as a first crossover voltage of the first and second analog signal if the comparison result of the voltage of the first analog signal with the voltage of the second analog signal at the first sampling point is different from that of the voltage of the first analog signal with the voltage of the second analog signal at the second sampling point, (f) repeating steps (c) to (e) to obtain a second crossover voltage which is different from the first crossover voltage and calculating the average of the first and second crossover voltage as a temporary reference voltage, and (g) repeating step (f) until the first and second analog signal are free from voltage drift and noise interference and calculating the average of the temporary reference voltages as a reference voltage for the microcontroller.
According to the design described above, the first and second analog signals are sinusoidal signal, respectively, and the phase difference is 90 degrees.